package decorator
{
	import flash.events.IEventDispatcher;
	
	public class StringReader extends AbstractReader
	{
		private var _content:String;
		public function StringReader(content:String)
		{
			_content = content;
		}
		override public function read():String{
			return _content.charAt(index++);
		}
		
		override public function readArray(offset:uint=0, length:uint=0):Array{
			if(length == 0){
				length = _content.length - offset;
			}
			var ary:Array = new Array;
			for(var i:uint=offset;i<length;i++){
				ary.push(_content[i]);
			}
			return ary;
		}
		
		override public function readString():String{
			return _content;
		}
		
		override public function hasNext():Boolean{
			return index < _content.length;
		}
		
	}
}